import request from '@/utils/request.js'
const PATH = '/admin/notice'

// 获取公告列表
export const getNoticeList = ({ page, pageSize, title }) => {
  return request.get(PATH + '/page', {
    params: {
      page,
      pageSize,
      title
    }
  })
}

// 新增公告
export const insertNotice = (data) => {
  return request.post(PATH + '/insert', data)
}

// 批量删除公告
export const batchDeleteNotice = (ids) => {
  return request.delete(PATH + '/batchDelete', {
    params: {
      ids: ids.join(',')
    }
  })
}

// 修改公告状态
export const updateNoticeStatus = (id) => {
  return request.put(PATH + `/status/${id}`)
}

// 根据id获取公告
export const getNoticeById = (id) => {
  return request.get(PATH + '/getNoticeById', {
    params: {
      id
    }
  })
}

// 修改公告
export const updateNotice = (data) => {
  return request.put(PATH + '/update', data)
}
